package com.novatialabs.qttt.gwt.client;

import com.google.gwt.event.shared.GwtEvent;

/**
 * Represents a QTTT mark event. Such as click on a given cell.
 */
public class MarkEvent extends GwtEvent<MarkHandler> {

  /**
   * Event type for mark events. Represents the meta-data associated with this
   * event.
   */
  private static final Type<MarkHandler> TYPE = new Type<MarkHandler>();
  private final int cellNumber;

  public MarkEvent(int cellNumber) {
    this.cellNumber = cellNumber;
  }

  /**
   * Gets the event type associated with click events.
   * 
   * @return the handler type
   */
  public static Type<MarkHandler> getType() {
    return TYPE;
  }

  @Override
  public final Type<MarkHandler> getAssociatedType() {
    return TYPE;
  }

  @Override
  protected void dispatch(MarkHandler handler) {
    handler.onMark(this);
  }

  public int getCellNumber() {
    return cellNumber;
  }

}
